﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;

namespace common
{
    public class sysEval
    {
        private static Boolean isexist(object obj, string name)
        {
            PropertyInfo pi = obj.GetType().GetProperty(name);
            if (pi == null)
            {
                return false;
            }
            return true;
        }

        public static void evalCurUserAndDate(object obj)
        {
            string name = "filldate";
            if (isexist(obj, name))
            {
                PropertyInfo pi = obj.GetType().GetProperty(name);
                pi.SetValue(obj, DateTime.Now);
            }
            name = "filler";
            if (isexist(obj, name))
            {
                PropertyInfo pi = obj.GetType().GetProperty(name);
                pi.SetValue(obj, CurUser.get().username);
            }
        }
    }
}